#include <iostream>
using namespace std;
//在主类模版中完全定义友元函数
template <class T>
class Firendly
{
    T t;

public:
    Firendly(const T &theT) : t(theT)
    {
    }
    friend void f(const Firendly<T> &fo){
        cout << fo.t << endl;
    };
    void g() { f(*this); }
};
void h()
{
    f(Firendly<int>(1));
}
int main(int argc, char *argv[])
{
    h();
    Firendly<int>(2).g();
}